using System;

namespace Adoor.Domain.Tiers
{
    
	/// <summary>
	/// Summary description for Adresse.
	/// </summary>
	public abstract class Adresse
	{
		
		
	
		public virtual String Adresse1
		{
			get
			{   
				return this.m_adresse1;
			}
			set
			{ 
				this.m_adresse1 = value;
			}
		}


		public virtual String Adresse2
		{
			get
			{
				return this.m_adresse2;
			}
			set
			{ 
				this.m_adresse2 = value;
			}
		}

		//[ID_adresse]
							   

		public virtual Lieu Lieu
		{
			get
			{
				return this.m_lieu;
			}
			set
			{ 
				this.m_lieu = value;
			}
		}


		
		/// <summary>
		/// Called when user is creating a new entity.
		/// </summary>
		protected virtual void OnCreate(object[] args)
		{
			Adresse1 = "";		
			Adresse2 = "";		
		}
		
		/// <summary>
		/// Called when user is retreiving an entity from storage
		/// </summary>
		protected virtual void OnMaterialize()
		{

		}
		
		
		
		protected abstract System.String m_adresse1 { get; set; }
		
		protected abstract System.String m_adresse2 { get; set; }
		
		protected abstract Lieu m_lieu { get; set; }
		
		
		#region user code class
		//		public static DataTable RechercherTachesAttente(string projetOID)
		//		{
		//			DataTable maTable=new DataTable();
		//			StringBuilder monStringBuilder=new StringBuilder();
		//
		//			monStringBuilder.Append(" Select min(MouvementTache.Date),Tache as TacheOID, Tache.Date as Date, Tache.StatutTache as StatutTache, Utilisateur.Nickname as Utilisateur ");
		//			monStringBuilder.Append(" From MouvementTache ,MouvementTache.Tache, Tache.Projet,MouvementTache.Utilisateur ");
		//			monStringBuilder.Append(" Where Tache.StatutTache< ? ");
		//			monStringBuilder.Append(" And Tache.Type=? ");
		//			monStringBuilder.Append(" And Projet= ? ");
		//			monStringBuilder.Append(" Group by Tache,Tache.Date,Tache.StatutTache, Utilisateur.Nickname");
		//			Satori.ObjectContext.Current.RemoteSource.Fill( maTable, monStringBuilder.ToString(),Satori.CRM.StatutTache.Traite ,Satori.CRM.TypesTache.Correction, projetOID);
		//			DataColumn maColonne=new DataColumn();
		//			maColonne.ColumnName="Statut";
		//			maTable.Columns.Add(maColonne);
		//			maColonne=new DataColumn();
		//			maColonne.ColumnName="Cause";
		//			maTable.Columns.Add(maColonne);
		//
		//
		//			DataTable tableCause=new DataTable();
		//			StringBuilder stCause=new StringBuilder();
		//			stCause.Append(" Select Tache.Cause as Cause from Tache where Tache=?");
		//			foreach (DataRow ligne in maTable.Rows)
		//			{
		//				tableCause=new DataTable();
		//				Satori.ObjectContext.Current.RemoteSource.Fill( tableCause, stCause.ToString(),ligne["TacheOID"].ToString());
		//				ligne["Cause"]=tableCause.Rows[0]["Cause"];
		//				ligne["Statut"]=(Satori.CRM.StatutTache) Convert.ToInt32(ligne["StatutTache"]);
		//				
		//				//				switch (ligne["StatutTache"].ToString())
		//				//				{
		//				//					case "0":
		//				//						ligne["Statut"]=StatutTache.Attente.ToString();
		//				//						break;
		//				//					case "1":
		//				//						ligne["Statut"]=StatutTache.EnCours.ToString();
		//				//						break;
		//				//					case "2":
		//				//						ligne["Statut"]=StatutTache.Traite.ToString();
		//				//						break;
		//				//				}
		//				
		//			}
		//			
		//			return maTable;
		//		}
		//
		//		public static DataTable RechercherTacheTraitee(string projetOID)
		//		{
		//			DataTable maTable=new DataTable();
		//			StringBuilder monStringBuilder=new StringBuilder();
		//
		//			monStringBuilder.Append(" Select max(MouvementTache.DateFin), Tache as TacheOID, Tache.Date as Date,Utilisateur.Nickname as Utilisateur ");
		//			monStringBuilder.Append(" from MouvementTache, MouvementTache.Tache,Tache.Projet, MouvementTache.Utilisateur ");
		//			monStringBuilder.Append(" where Tache.StatutTache= ? ");
		//			monStringBuilder.Append(" And Tache.Type=?");
		//			monStringBuilder.Append(" and Projet= ?");
		//			monStringBuilder.Append(" Group by Tache , Tache.Date ,Utilisateur.Nickname ");
		//
		//			Satori.ObjectContext.Current.RemoteSource.Fill( maTable, monStringBuilder.ToString(),Satori.CRM.StatutTache.Traite ,Satori.CRM.TypesTache.Correction, projetOID);
		//			
		//			DataColumn maColonne=new DataColumn();
		//			maColonne.ColumnName="Cause";
		//			maTable.Columns.Add(maColonne);
		//			DataTable tableCause=new DataTable();
		//			StringBuilder stCause=new StringBuilder();
		//			stCause.Append(" Select Tache.Cause as Cause from Tache where Tache=?");
		//			foreach (DataRow ligne in maTable.Rows)
		//			{
		//				tableCause=new DataTable();
		//				Satori.ObjectContext.Current.RemoteSource.Fill( tableCause, stCause.ToString(),ligne["TacheOID"].ToString());
		//				ligne["Cause"]=tableCause.Rows[0]["Cause"];
		//			}
		//			return maTable;
		//		}
		//
		//		public static DataTable RechercheDemande()
		//		{
		//			DataTable maTable=new DataTable();
		//			StringBuilder monStringBuilder=new StringBuilder();
		//
		//			monStringBuilder.Append(" Select Tache as TacheOID, Tache.Date as Date, Tache.Cause as Cause ");
		//			//			monStringBuilder.Append("select Tache.*");
		//			monStringBuilder.Append(" from Tache ");
		//			monStringBuilder.Append(" Where Tache.Type=?");
		//			Satori.ObjectContext.Current.RemoteSource.Fill( maTable, monStringBuilder.ToString(),Satori.CRM.TypesTache.DemandeEvolution);
		//			return maTable;
		//		}
		//
		//		public static DataTable Utilisateur()
		//		{
		//			StringBuilder monStringBuilder=new StringBuilder();
		//			DataTable maTable=new DataTable();
		//			monStringBuilder.Append(" Select Utilisateur as OID, Utilisateur.NickName as Nom");
		//			monStringBuilder.Append(" From Utilisateur ");
		//			Satori.ObjectContext.Current.RemoteSource.Fill( maTable, monStringBuilder.ToString());
		//			return maTable;
		//		}

		#endregion user code class
		
	}
}
